package com.hospital.data.simulation.controller;

import com.hospital.common.base.Result;
import com.hospital.common.pojo.TDoctorInfo;
import com.hospital.data.simulation.service.TDoctorInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 医生详细信息管理接口
 * @author yhn
 * @version 1.0
 */
@RestController
@RequestMapping("/doctorInfo")
public class DoctorInfoController {
    @Autowired
    private TDoctorInfoService doctorInfoService;

    /**
     * 添加医生信息
     * @return 添加的医生信息ID
     */
    @PostMapping("/add")
    public Result<Long> addDoctorInfo(@RequestBody TDoctorInfo doctorInfo) {
        return Result.success(doctorInfoService.addDoctorInfo(doctorInfo));
    }
    /**
     * 删除医生信息
     * @param id 医生信息ID
     */
    @DeleteMapping("/delete")
    public Result<?> deleteDoctorInfo(@RequestParam("id") Long id) {
        doctorInfoService.deleteDoctorInfo(id);
        return Result.success();
    }
    /**
     * 更新医生信息
     * <br>
     * 更新信息中必须带有id
     * @param doctorInfo 医生信息
     */
    @PostMapping("/update")
    public Result<?> updateDoctorInfo(@RequestBody TDoctorInfo doctorInfo) {
        doctorInfoService.updateDoctorInfo(doctorInfo);
        return Result.success();
    }
}
